from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
from school.models import School


class UserProfile(AbstractUser):
    mobile = models.CharField(max_length=11, verbose_name="电话", help_text="电话",db_index=True)
    gender = models.IntegerField(choices=((1, "男"), (2, "女")), default=1, verbose_name="性别", help_text="性别",db_index=True)
    school = models.ForeignKey(School,verbose_name='所属校区',help_text='所属校区',on_delete=models.CASCADE,null=True,blank=True)

    class Meta:
        verbose_name = "用户"
        verbose_name_plural = verbose_name
        ordering = ['-id', '-date_joined']


    def __str__(self):
        return self.username
